package com.mdlaser.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 *
 * </p>
 *
 * @author mdlaser
 * @since 2024-05-16
 */
@Getter
@Setter
@TableName("orders_wishes")
@Schema(name = "OrdersWishes", description = "$!{table.comment}")
public class OrdersWishes implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键")
    @TableId(value = "order_id", type = IdType.AUTO)
    private Integer orderId;

    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;

    @TableField("language_id")
    private String languageId;

    @Schema(description = "预约日期")
    @TableField("appt_date")
    private Date apptDate;


    @Schema(description = "开始播放时间")
    @TableField("start_time")
    private Date startTime;


    @Schema(description = "结束播放时间")
    @TableField("stop_time")
    private Date stopTime;


    @Schema(description = "预约人")
    @TableField("appt_user")
    private String apptUser;

    @Schema(description = "接收人")
    @TableField("appt_recipient")
    private String apptRecipient;

    @Schema(description = "预约电话")
    @TableField("appt_phone")
    private String apptPhone;

    @Schema(description = "订单状态 1-待支付 2-已支付 3-已退款")
    @TableField("order_status")
    private Integer orderStatus;

    @Schema(description = "支付金额")
    @TableField("payment_amount")
    private Float paymentAmount;

    @Schema(description = "备注")
    @TableField("notes")
    private String notes;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @TableField(value = "refund_time")
    private Date refundTime;


    @Schema(description = "支付时间")
    @TableField("pay_time")
    private Date payTime;

    @Schema(description = "vx订单号")
    @TableField("transaction_id")
    private String transactionId;


    private static String ORDER_SUFFIX = "mdlaser";
    private static String UTREFUNDNO = "mdlaser_refund";

    public static String getVxOrderId(String orderId) {
        return ORDER_SUFFIX + orderId;
    }

    public static String getOriginalId(String orderId) {
        return orderId.replace(ORDER_SUFFIX, "");
    }

    public static String getOutRefundNo(String orderId) {
        return UTREFUNDNO + orderId;
    }
}
